<%@ page import="databeans.*"%>
<%@ page import="java.util.ArrayList" %>

<jsp:include page="../common/messages.jsp"/>


<% 
  String customerID = (String)request.getAttribute("customerID");
  if (customerID!=null){
%>
<div id="box">
<script>
$('#acc-info').colorize({ hoverColor:'none', ignoreHeaders :true, hiliteColor :'none' });
</script>
<div class="acc-info">
<table id="acc-info">
	<tbody>
		<tr>
			<td class="bold">Name</td>
			<td>
				<%=request.getAttribute("name")%>
			</td>
		</tr>
		<tr>
			<td class="bold">Email</td>
			<td>
				<%=request.getAttribute("email")%>
			</td>
		</tr>
		<tr>
			<td class="bold">Address</td>
			<td>
				<%=request.getAttribute("address")%>
			</td>
		</tr>
		<tr>
			<td class="bold">Cash Balance</td>
			<td>
				$<%=request.getAttribute("cashBalance")%>
			</td>
		</tr>
		<tr>
			<td class="bold">Cash Available</td>
			<td>
				$<%=request.getAttribute("availableCash")%>
			</td>
		</tr>
<% 
String lastTradingDate = (String)request.getAttribute("lastTradingDate");
String lastSubmissionDate = (String)request.getAttribute("lastSubmissionDate"); 
if(lastTradingDate!=null){
%>
	
		<tr>
			<td class="bold">Last Trading Date</td>
			<td>
				<%=request.getAttribute("lastTradingDate")%>
			</td>
		</tr>
<% 
}else{
%>
								<tr>
									<td><b></>Last Submission Date</b><br/>(No transaction has been executed)</td>
									<td>
										<%=request.getAttribute("lastSubmissionDate")%>
									</td>
								</tr>
		
<%} %>
		<tr>
			<td class="bold">Shares Owned</td>
			<td>
				<ul>
				<%
					Position[] positions = (Position[])request.getAttribute("positions");
				    ArrayList<Double> values = (ArrayList<Double>)request.getAttribute("values");
				    ArrayList<String> fundNames = (ArrayList<String>)request.getAttribute("fundNames");
					for(int i=0; i<positions.length; i++){
				%>
					<li class="fund"><h3><a href="#" title="View Fund Info"><%=fundNames.get(i)%></a></h3>
						<ul>
							<li>Shares: &nbsp;<%=positions[i].getShares()%></li>
							<li><%  
							     if (values.get(i).doubleValue()==0.00){ 
								%>
							    Transaction is still pending
								<% }else{%>
								Value:    &nbsp;$<%=values.get(i)%>
								<% } %>
							</li>
						</ul>
					</li>
				<% } %>
				</ul>
			</td>
		</tr>
	</tbody>
</table>
</div>
<%} %>
</div>